<script>
	export default {
		//注意：App的升级检测代码必须使用条件编译，否则在微信环境由于不存在plus相关API，将会报错。
		onLaunch: function() {
			let ua = window.navigator.userAgent.toLowerCase()
			// 通过正则表达式匹配ua中是否含有MicroMessenger字符串
			if (ua.match(/MicroMessenger/i) == 'micromessenger') {
				
			} else {
				window.location.hash="download";  //替换地址栏
				if(window.location.hash.includes('download')){
				    window.location.href = "http://yun.youpilive.com/api/index/DownLoadApk"
				}
				return
			
			}
			uni.setStorageSync('recommendIndex',1)
			 //#ifdef APP-PLUS
			    var server = "https://www.example.com/update"; //检查更新地址
			    var req = { //升级检测数据
			        "appid": plus.runtime.appid,
			        "version": plus.runtime.version
			    }; 
			    uni.request({
			        url: server,
			        data: req,
			        success: (res) => {
			            if (res.statusCode == 200 && res.data.status === 1) {
			                uni.showModal({ //提醒用户更新 
			                    title: "更新提示",
			                    content: res.data.note,
			                    success: (res) => {
			                        if (res.confirm) {
			                            plus.runtime.openURL(res.data.url);
			                        }
			                    }
			                })
			            }
			        }
			    })
			// #endif	
			console.log('App Launch')
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
</style>
